package com.login.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONArray;

import org.apache.log4j.Logger;

import com.common.util.BaseAction;
import com.login.action.fo.ManageFinaFO;
import com.login.service.IManagingFinancialServ;
import com.pojo.SysmenuPojo;

public class ManagFinaAction extends BaseAction{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static Logger log = Logger.getLogger(ManagFinaAction.class);
	private ManageFinaFO fo;
	private String name;
	private String id;
	private int orderNum;

	private IManagingFinancialServ serv;
	private int page;
	private int rows;
	private int total;
	
	public String searchFinaList() {
	String result = serv.searchFinaList();
	PrintWriter out =null;
		try {
			 out = response.getWriter();
			response.setCharacterEncoding("utf-8");
			out.write(result);

		} catch (IOException e) {
			log.error("search fina error", e);
		}
	//	return "success"; 不能这样返回  引起前台页面数据展现不出来		
		return null;
	}
	
	public String addSaveFina()
	{
		Map<String, Object> paraMap = new HashMap<String, Object>();
		paraMap.put("name", name);
		paraMap.put("orderNum", orderNum);
		serv.saveSysmenu(paraMap);
		return "success";
	}
	
	public String deleteByIds() throws IOException {
		try {
			String ids = request.getParameter( "ids");
			boolean isFlag =serv.deleteByIdString(ids);
			response.setContentType("text/html;charset=utf-8");
			if (isFlag)
				message = "删除成功";
			else
				message = "删除失败";
			StringBuffer sb = new StringBuffer("[");
			sb.append("{\"message\":\"" + message + "\"" + "}");
			sb.append("]");
			this.response.getWriter().print(sb.toString());
		} catch (Exception e) {
			log.error("delete menulist error", e);
		}
		return null;
	}
	
	public ManageFinaFO getFo() {
		return fo;
	}


	public void setFo(ManageFinaFO fo) {
		this.fo = fo;
	}


	public IManagingFinancialServ getServ() {
		return serv;
	}
	public void setServ(IManagingFinancialServ serv) {
		this.serv = serv;
	}
	public int getPage() {
		return page;
	}
	public void setPage(int page) {
		this.page = page;
	}
	public int getRows() {
		return rows;
	}
	public void setRows(int rows) {
		this.rows = rows;
	}
	public int getTotal() {
		return total;
	}
	public void setTotal(int total) {
		this.total = total;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public int getOrderNum() {
		return orderNum;
	}

	public void setOrderNum(int orderNum) {
		this.orderNum = orderNum;
	}

	
	
}
